package Demo2;

public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {

        ClassRoom classRoom = new ClassRoom(113);

        //对象的克隆
        Student student1 = new Student("zhangsan", 18, classRoom);
        Student cloneStudent = (Student) student1.clone();
        System.out.println(student1 == cloneStudent);
        System.out.println(student1.equals(cloneStudent));
        student1.classRoom.classRoom=114;
        //只是一个浅拷贝
        System.out.println(cloneStudent.toString());









//        System.out.println(student1.toString());
//        classRoom.classRoom = 114;
//        System.out.println(student1.toString());
//        Student cloneStudnet = (Student) student1.clone();
//        System.out.println(student1 == cloneStudnet);
//        System.out.println(student1.equals(cloneStudnet));

    }
}
